<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Swoole\Buffer class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="swoole-atomic.sub.html">« Swoole\Atomic::sub</a></li>
      <li style="float: right;"><a href="swoole-buffer.append.html">Swoole\Buffer::append »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.swoole.html">Swoole</a></li>
    <li>The Swoole\Buffer class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.swoole-buffer" class="reference">

 <h1 class="title">The Swoole\Buffer class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL swoole &gt;= 1.9.0)</p>


  <div class="section" id="swoole-buffer.intro">
   <h2 class="title">简介</h2>
   <p class="para">

   </p>
  </div>


  <div class="section" id="swoole-buffer.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Swoole\Buffer</strong>
     </span>
     {</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.append.html" class="methodname">append</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.clear.html" class="methodname">clear</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.destruct.html" class="methodname">__destruct</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.expand.html" class="methodname">expand</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.read.html" class="methodname">read</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.recycle.html" class="methodname">recycle</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.substr.html" class="methodname">substr</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = ?</span></span>, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$remove</code><span class="initializer"> = ?</span></span>): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.tostring.html" class="methodname">__toString</a></span>(): <span class="type">string</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="swoole-buffer.write.html" class="methodname">write</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$offset</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>

 </div>

 







































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="swoole-buffer.append.html">Swoole\Buffer::append</a> — Append the string or binary data at the end of the memory buffer and return the new size of memory allocated.</li><li><a href="swoole-buffer.clear.html">Swoole\Buffer::clear</a> — Reset the memory buffer.</li><li><a href="swoole-buffer.construct.html">Swoole\Buffer::__construct</a> — Fixed size memory blocks allocation.</li><li><a href="swoole-buffer.destruct.html">Swoole\Buffer::__destruct</a> — Destruct the Swoole memory buffer.</li><li><a href="swoole-buffer.expand.html">Swoole\Buffer::expand</a> — Expand the size of memory buffer.</li><li><a href="swoole-buffer.read.html">Swoole\Buffer::read</a> — Read data from the memory buffer based on offset and length.</li><li><a href="swoole-buffer.recycle.html">Swoole\Buffer::recycle</a> — Release the memory to OS which is not used by the memory buffer.</li><li><a href="swoole-buffer.substr.html">Swoole\Buffer::substr</a> — Read data from the memory buffer based on offset and length. Or remove data from the memory buffer.</li><li><a href="swoole-buffer.tostring.html">Swoole\Buffer::__toString</a> — Get the string value of the memory buffer.</li><li><a href="swoole-buffer.write.html">Swoole\Buffer::write</a> — Write data to the memory buffer. The memory allocated for the buffer will not be changed.</li></ul>
</div>
</div></div></body></html>